package cjp.itcast.controller;

import cjp.itcast.mapper.TypeMapper;
import cjp.itcast.pojo.vo.PortalVo;
import cjp.itcast.service.HeadlineService;
import cjp.itcast.service.TypeService;
import cjp.itcast.utils.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @author 陈建平
 */
@RestController
@RequestMapping("portal")
@CrossOrigin
public class ProtalController {
    @Autowired
    private TypeService typeService;
    @Autowired
    private HeadlineService headlineService;


    /**
     * 查询首页
     */
    @GetMapping("findAllTypes")
    public Result findAllTypes() {
        Result result = typeService.findAllTypes();
        return result;
    }
    /**
     * 首页分页查询
     * @return
     */
    @PostMapping("findNewPage")
    public Result findNewPage(@RequestBody PortalVo portalVo){
        Result result = headlineService.findNewPage(portalVo);
        return result;
    }
}
